import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import '@daelui/dogui/dist/css/boost.min.css'
import '@daelui/dogui/dist/css/theme/black.min.css'
import dog from '@daelui/dogjs/dist/index'
import 'element-ui/lib/theme-chalk/index.css'
import $pig from '@daelui/pigjs'

const isProd = process.env.NODE_ENV === 'production'
const win = typeof self !== 'undefined' ? window : global
// 是否运行态
const ap = (window.application || {}).molecule || {}
ap.mode = ap[isProd ? 'prod' : 'dev']
// 初始化模块配置
const loader = ap.mode.loader || {}
const rootUrl = loader.rootUrl || location.origin
$pig.init({
  path: loader.path || rootUrl + '@daelui/pigjs/latest/dist/system.min.js',
  registry: loader.registry || location.origin + '/packages.json',
  rootUrl: rootUrl,
  rootUrls: loader.rootUrls,
  resolutions: [{ name: 'vue', version: '2.*.*' }]
})
var $dog = win.$dog
if ($dog) {
  for (let key in $dog) {
    dog[key] = $dog[key]
  }
}
win.$dog = $dog = dog
win.MonacoWorkerBaseUrl = './static/'

Vue.config.productionTip = false
Vue.use(ElementUI)

new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
